package com.ttg.utils.connection.handler;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

public class BytesResponseHandler implements ResponseHandler<byte[]> {
    public byte[] handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
        HttpEntity entity = null;

        byte[] var4;
        try {
            entity = ResponseHandlerHelper.handleNon2xxStatus(response);
            byte[] result = EntityUtils.toByteArray (entity);
            var4 = result;
        } finally {
            EntityUtils.consume(entity);
        }

        return var4;
    }


}
